<!DOCTYPE html>
<html>
<head>
	<include file='Common:header' />
	<script type="text/javascript">
		var json = $.parseJSON('<{$json}>');
		$(function () {
			$.each($("#jslibs").find("label"), function () {
				var texts = $(this).text();
				var obj = json[$.trim(texts)];
				if (obj && obj['desc']) {
					$(this).tooltip({title:obj['desc'], placement:'top'});
				}
			})
		});
		//checkbox按列全选
		var checkall = function (obj, colnum) {
			//获取所在的行和列
			var col = $(obj).closest('table').find('tr').find('td:eq(' + (parseInt(colnum) - 1) + ')');
			if (obj.checked) {
				$(col).find('input').attr('checked', 'on');
			} else {
				$(col).find('input').removeAttr('checked');
			}
		};
	</script>
	<style type="text/css">
			/*#listlib .btn {*/
			/*width: 60px;*/
			/*}*/
	</style>
</head>
<body>
<include file='Common:navbar' />

<div class="container content">
	<div class="row">
		<div class="span3 body-content">
			<include file="Common:leftbar" />
		</div>
		<div class="span9">
			<div class="" style="margin-top: 10px;">
				<div class="alert alert-info">
					提示：以下js库放置在TP助手的 <code>public/jsLib</code> 目录下，您可以自由增减。<br />
					库文件将被复制到 : <code>APP_PATH/js/</code>
				</div>
				<div id="listlib">
					<notempty name="jsLib">
						<form id="jslibs" method="post" enctype="application/x-www-form-urlencoded" action="__URL__/addlibs">
							<table class="table table-striped">
								<thead>
								<tr>
									<th>
										<input id="selectall" type="checkbox" class="checkbox" onchange="checkall(this,1)">
									</th>
									<th>
										<label for="selectall" style="margin-bottom: 0;font-weight: bold;">类库</label>
									</th>
									<th>大小</th>
									<th>官网</th>
								</tr>
								</thead>
								<foreach name="jsLib" item="lib">
									<tr>
										<td><input id="<{$key}>" type="checkbox" name="jslibs[<{$key}>]" class="checkbox"></td>
										<td><label for="<{$key}>"><{$key}></label></td>
										<td id="size_of_<{$key}>">
										</td>
										<script type="text/javascript">
											$(function () {
												try {
													$(document.getElementById('size_of_<{$key}>')).text(json['<{$key}>']['size']);
												}catch(e) {

												}
											})
										</script>
										<td><a onclick="window.open(json['<{$key}>']['site'])" style="cursor: pointer;">访问</a></td>
									</tr>
								</foreach>
							</table>
							<input class="btn btn-large btn-primary" type="submit" value="添加到项目">
						</form>
					</notempty>
					<empty name="jsLib">
						没有找到任何可添加的js库
					</empty>
				</div>

			</div>
		</div>
	</div>
</div>
<{$footer}>
</body>
</html>

